package com.zhan.ielts.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.zhan.frame.core.dao.impl.BaseDaoImpl;
import com.zhan.frame.core.exception.DaoException;
import com.zhan.frame.core.utils.BeanUtils;
import com.zhan.ielts.dao.ZhentiCompositionDao;
import com.zhan.ielts.domain.Param;
import com.zhan.ielts.domain.ZhentiComposition;
import com.zhan.ielts.domain.vo.ZhentiCompositionVo;

@Repository
public class ZhentiCompositionDaoImpl extends BaseDaoImpl<ZhentiComposition> implements ZhentiCompositionDao {

	@Override
	public void updateParamVersion(Param param) {
		try {
			Map<String, Object> params = BeanUtils.toMap(param);
			sqlSessionTemplate.update(getSqlName("updateParamVersion"), params);
		} catch (Exception e) {
			throw new DaoException(String.format("查询对象数量出错！语句：%s", getSqlName("updateParamVersion")), e);
		}
	}

	@Override
	public List<ZhentiComposition> selectLatest(ZhentiCompositionVo entity) {
		return sqlSessionTemplate.selectList(getSqlName("selectLatestOnes"), entity);
	}

}
